package de.gameduell.framework.modules.event
{
	import de.gameduell.framework.debug.Debug;
	import de.gameduell.net.src.communication.ServerMessageEvent;
	
	/**
	 * player [playerId] [isKi: yes=1/no=0] [playername] [player-avatar-url]
	 **/
	public class PlayerJoinEvent extends NetworkEvent 
	{
		public static const PLAYER_JOIN:String = "playerJoin";

		public var playerId:int;
		public var playerName:String;
		public var isAi:Boolean;
		public var playerAvatarUrl:String;
		
		public function PlayerJoinEvent(event:ServerMessageEvent) {
			super(PLAYER_JOIN);
			
			playerId = int(event.parameters[0]);
			isAi = (event.parameters[1] == "1");
			playerName = event.parameters[2];
			playerAvatarUrl = event.parameters[3];
			
			if (isAi) {
				playerName = "ai_" + playerId;
			}
			
			Debug.trace("PlayerJoinEvent() playerId:" + playerId + " isAi:" + isAi + " playerName:" + playerName + " playerAvatarUrl:" + playerAvatarUrl);
		}

	}
		 
	
}